package com.hjj.homieMatching.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hjj.homieMatching.model.domain.Blog;
import com.hjj.homieMatching.model.request.BlogAddRequest;
import com.hjj.homieMatching.model.request.BlogEditRequest;
import com.hjj.homieMatching.model.request.BlogQueryRequest;
import com.hjj.homieMatching.model.request.DeleteRequest;
import com.hjj.homieMatching.model.vo.BlogVO;
import com.hjj.homieMatching.model.vo.LikeRequest;
import com.hjj.homieMatching.model.vo.StarRequest;
import com.hjj.homieMatching.model.vo.UserBlogVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author 黄健健
 * @description 针对表【blog(博客表)】的数据库操作Service
 */
public interface BlogService extends IService<Blog> {

    /**
     * 添加博客
     * @param blogAddRequest 博客添加请求
     * @param request HTTP请求
     * @return 博客id
     */
    Long addBlog(BlogAddRequest blogAddRequest, HttpServletRequest request);

    /**
     * 获取博客列表
     * @param blogQueryRequest 博客查询请求
     * @param request HTTP请求
     * @return 博客列表
     */
    List<BlogVO> listBlogs(BlogQueryRequest blogQueryRequest, HttpServletRequest request);

    /**
     * 获取博客详情
     * @param id 博客id
     * @param request HTTP请求
     * @return 博客详情
     */
    BlogVO getBlogDetailById(Long id, HttpServletRequest request);

    /**
     * 删除博客
     * @param deleteRequest 删除请求
     * @param request HTTP请求
     * @return 是否删除成功
     */
    boolean deleteBlog(DeleteRequest deleteRequest, HttpServletRequest request);

    /**
     * 收藏博客
     * @param starRequest 收藏请求
     * @param request HTTP请求
     * @return 是否收藏成功
     */
    boolean starBlog(StarRequest starRequest, HttpServletRequest request);

    /**
     * 点赞博客
     * @param likeRequest 点赞请求
     * @param request HTTP请求
     * @return 是否点赞成功
     */
    boolean likeBlog(LikeRequest likeRequest, HttpServletRequest request);

    /**
     * 取消收藏博客
     * @param starRequest 取消收藏请求
     * @param request HTTP请求
     * @return 是否取消收藏成功
     */
    boolean cancelStarBlog(StarRequest starRequest, HttpServletRequest request);

    /**
     * 取消点赞博客
     * @param likeRequest 取消点赞请求
     * @param request HTTP请求
     * @return 是否取消点赞成功
     */
    boolean cancelLikeBlog(LikeRequest likeRequest, HttpServletRequest request);

    /**
     * 获取用户博客列表
     * @param userId 用户id
     * @param blogQueryRequest 博客查询请求
     * @param request HTTP请求
     * @return 博客列表
     */
    List<BlogVO> listUserBlogs(Long userId, BlogQueryRequest blogQueryRequest, HttpServletRequest request);

    /**
     * 获取交互博客列表（点赞、收藏、浏览）
     * @param blogQueryRequest 博客查询请求
     * @param request HTTP请求
     * @return 博客列表
     */
    List<BlogVO> listInteractionBlogs(BlogQueryRequest blogQueryRequest, HttpServletRequest request);

    /**
     * 获取用户交互博客列表
     * @param blogQueryRequest 博客查询请求
     * @param request HTTP请求
     * @return 用户博客VO
     */
    UserBlogVO listUserInteractionBlogs(BlogQueryRequest blogQueryRequest, HttpServletRequest request);

    /**
     * 编辑博客
     * @param blogEditRequest 博客编辑请求
     * @param request HTTP请求
     * @return 博客id
     */
    long editBlog(BlogEditRequest blogEditRequest, HttpServletRequest request);

    /**
     * 检查博客是否被点赞
     * @param blogId 博客id
     * @param userId 用户id
     * @return 是否被点赞
     */
    boolean isLiked(Long blogId, Long userId);

    /**
     * 检查博客是否被收藏
     * @param blogId 博客id
     * @param userId 用户id
     * @return 是否被收藏
     */
    boolean isStarred(Long blogId, Long userId);
}
